<?php
	include_once 'isLogin.php';
	$adminc = new admin();
	$id = $_GET['id'];

	if($id){
		$info = $adminc->getAdminInfo($id);
	}
	$smarty->assign("info" , $info);
	
	
	if($_POST){
		$arr= array(
			'name' => $_POST['username'],
			'pwd' => md5($_POST['password']),
			'flag' => $_POST['flag'],
			'intro' => $_POST['intro'],
			);

		if($id){
			$adminc->adminUpdate($arr, ' id ="'.$id.'"');
			$msg = '跟新成功！';
		}else{
			$id = $adminc->adminAdd($arr);
			$msg = '添加成功';
		}
		$url = $page_basename.'?id='.$id;
		echo $commonc->submitAlert($msg,$url);
		exit();
	}
	
	$smarty->display("example_edit.html");
?>